#include <iostream>
using namespace std;

int main()
{
	int count = 0, m;
	for(int i = 1; i <= 2019; i++)
	{
		m = i;
		while(m)
		{
			if(m % 10 == 9)
			{
				count++;
				break;
			}
			m /= 10;
		}
	}
	cout << count << endl;
	return 0;
}
